#pragma once
#ifndef USERINTERFACE_H
#define USERINTERFACE_H

//@author U094709Y
#include <string>
#include "Executor.h"
#include <vcclr.h>

#define BUFFER_SIZE 255
#define NUMBER_OF_SYSTEM_MSG 27

using namespace std;
using namespace System::Data;

class UserInterface
{
private:
        static const string MESSAGE[NUMBER_OF_SYSTEM_MSG];
        static const string MESSAGE_WELCOME;

		static char systemMessage[BUFFER_SIZE];
		static bool isPrintSystemMessage;

public:
		static enum DISPLAY_TYPE {
			TASK_DISPLAY, TASK_DETAIL, CHECKEDBOXLIST, SELECTLIST_PENDING, SELECTLIST_FLOATING
		};

        static enum MESSAGE_TYPE {
                ADDED, CLEARED, CLEARED_ALL, DELETED, DONE, EMPTY_FILE, 
                INVALID_CMD, INVALID_DATE, INVALID_INT, INVALID_TASK, INVALID_TASK_NO, INVALID_TIME, 
                MATCH_UNFOUND, EDITTED, INVALID_EDIT_CMD, NO_TASK_OF_TYPE, NO_TASK_ON, NO_TIMING, 
				ALREADY_DONE, UNDONE, INVALID_UNDO, INVALID_POSTPONE, UNDATED_REPEAT, NODATE_REPEAT, 
				INVALID_FREQ, POSTPONED_SINGLE, POSTPONED_ALL
        };

		static string trim(const string& s, const string& delimiters = " \f\n\r\t\v" );
        bool stringObjToStdConversion(System::String^ source, string& result);
		string getDateOrTime(System::String^ dateTime, bool isDate = true);

        string generateWelcomeMessage(void);
		void clearSystemMessage(void);
		string getSystemMessage(void);
		string generateMessage(string msg, string param, string param1 = "", string param2 = "");

        void startingExecutor(void);
		string readUserInput(System::String^ input, DISPLAY_TYPE uiType = TASK_DISPLAY, bool isDone = false);
        string sendingInputToExecutor(string& input);

        string generateHelpList(void);

		DataTable^ getTaskList(string date);
		DataTable^ getPendingList(void);
		DataTable^ getFloatingList(void);	

private: 
		MESSAGE_TYPE determineMessageType(string msg);

		DataTable^ generateTableType(DISPLAY_TYPE displayFormat);

};

#endif